home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / networking / 3356 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  21.1 KB

  1. Path: cs.uwa.edu.au!jasonb
  2. From: jasonb@cs.uwa.edu.au (Jason S Birch)
  3. Newsgroups: comp.sys.amiga.networking
  4. Subject: Re: Announce: AWeb 1.0 released!
  5. Date: 2 Apr 96 06:31:41 GMT
  6. Organization: The University of Western Australia
  7. Message-ID: <jasonb.828426701@cs.uwa.edu.au>
  8. References: <4iva78$5pa@news.xs4all.nl> <4j1f6e$984@news.uni-c.dk> <jasonb.827822336@cs.uwa.edu.au> <4j8o6r$9vj@serpens.rhein.de> <jasonb.827896888@cs.uwa.edu.au> <4jaue8$jh4@serpens.rhein.de> <jasonb.827996764@cs.uwa.edu.au> <4je3qj$kk@serpens.rhein.de> <jasonb.828076494@cs.uwa.edu.au> <4jgdfr$8f4@serpens.rhein.de> <jasonb.828104646@cs.uwa.edu.au> <4jh986$a5o@serpens.rhein.de> <jasonb.828179619@cs.uwa.edu.au> <4jjcc7$hm4@serpens.rhein.de>
  9. NNTP-Posting-Host: decadence.cs.uwa.oz.au
  10. X-Newsreader: NN version 6.5.0 #3 (NOV)
  11.  
  12. mlelstv@serpens.rhein.de (Michael van Elst) writes:
  13. >But why should every single program manage priorities when there is
  14. >a more easy solution ?
  15.  
  16. Firstly, not every single program needs to do it -- only a program
  17. that wants to do some heavy computation and still interact with the
  18. user. The best way to do that is create a thread, and if you're
  19. creating a thread anyway you may as well use a value other than "0"
  20. for the priority when you call CreateNewProc() (or others), right?
  21. This benefits the user because the computer doesn't needlessly feel
  22. sluggish, and all interactive programs benefit whether they're MUI
  23. programs or not. Yes, MUI programs benefit more. But all interactive
  24. and I/O bound programs benefit some, and some is better than none.
  25.  
  26. Secondly, this allows a much simpler programming model for MUI that
  27. doesn't require locking and semaphore protecting of all data
  28. structures just to use the OO mechanism. 
  29.  
  30. >But MUI classes defer everything
  31. >to the application. The right way is to defer only the slow operations
  32. >to the application (or another low priority task).
  33.  
  34. What you propose is for some MUI attributes to be modifiable by
  35. input.device, and/or some MUI methods to be callable by input.device.
  36. Currently they are not -- only *one* thread may do MUI stuff, which
  37. greatly reduces the complexity of programming MUI classes.
  38.  
  39. >Programmers that _use_ a GUI toolkit do not care about this. Programmers
  40. >of new classes have to care.
  41.  
  42. Programmers of MUI are supposed to use an OO paradigm. That means
  43. creating custom classes for everything, rather than simply writing an
  44. iterative program that uses a GUI toolkit. It also means that writing
  45. custom classes should be easy, so the OO mechanism itself should not
  46. require you to deal with the possibility of multiple contexts
  47. executing your class.
  48.  
  49. >ClassAct doesn't make it easier. It isn't actually difficult.
  50.  
  51. I haven't used ClassAct, I was merely repeating a claim I think one of
  52. the developers of CA made when it was first released.
  53.  
  54. >Programmers that use the toolkit do not have care about any internals
  55. >and programmers of new classes have to know the internals of the toolkit.
  56. >There is no difference.
  57.  
  58. The "internals" in this case are the details of the OO mechanism,
  59. BOOPSI. All you need to know is how to register a new class and its
  60. dispatcher, and how to receive methods -- just the basic BOOPSI stuff
  61. (although it's simplified a bit by some MUI glue routines). You don't
  62. have to worry about locking of structures or anything like that,
  63. because you're guaranteed never to have more than one context ever
  64. sending methods to your class. Enabling different contexts to send
  65. methods (such as input.device telling you to draw yourself in a
  66. depressed state) would require you to be aware of these issues.
  67. Remember, MUI is completely general in that a class can respond to an
  68. activation in any way it sees fit, and *any* attribute of *any* class
  69. can have a notification set on it.
  70.  
  71. >>No -- because the OO system *itself* doesn't run at different
  72. >>priorities.
  73.  
  74. >I am sorry. You have some wrong ideas about what "the OO system" is.
  75. >MUI uses BOOPSI too, the OO system does run at the priority you use it
  76. >at.
  77.  
  78. I am sorry, but I think *you* are not understanding what I'm saying.
  79. The OO system is BOOPSI. The OO system itself (under MUI) doesn't run
  80. at different priorities. The OO system does run at the priority you
  81. use it at. All these are compatible, unless for some reason you think
  82. MUI uses BOOPSI under anything other than the app's context, in which
  83. case you'd be wrong.
  84.  
  85. >>Within a custom class, the OO mechanism is still running on
  86. >>the same context as the rest of the classes.
  87.  
  88. >No. If you invoke a method from the user's program the priority isn't
  89. >suddenly changed and the method is not executed by input.device.
  90.  
  91. This is correct, and is entirely consistent to that which you just
  92. said "No" to.
  93.  
  94. >>Any method you call, any
  95. >>attribute you set, is all still on the same context.
  96.  
  97. >Sorry, this is completely wrong.
  98.  
  99. Sorry, but it is completely right. But I know why you think it's
  100. wrong:
  101.  
  102. >As I said, MUI uses the same OO mechanism as gadgetclass.
  103.  
  104. Yes, MUI and gadgetclass both use BOOPSI. However MUI is *not*
  105. subclassed from gadgetclass. MUI's Notify class, superclass to all
  106. others, is directly subclassed from BOOPSI's rootclass, and therefore
  107. has nothing to do with Intuition gadgets. There are a long list of
  108. reasons for wanting to do this, with the only downside being that a
  109. handful of classes which would be simple enough to refresh under
  110. input.device without too much penalty to the system do not get
  111. refreshed there.
  112.  
  113. It's funny, but I'm sure I saw you complaining about this last year,
  114. so I assumed you knew it. Hmm... Perhaps it was someone else.
  115.  
  116. >>Within those other contexts, you
  117. >>can't call methods and set attributes of other objects directly.
  118.  
  119. >This is wrong. Of course you can do this. 
  120.  
  121. No, you cannot. You are not allowed to send methods and set attributes
  122. to/of MUI objects unless they are on the same context. There is only
  123. *one* exception to this, MUIM_Application_PushMethod, which allows you
  124. to give the application object a method you want processed when it
  125. gets around to it, and *it* deals with all the issues of locking and
  126. multiple contexts for you, so the class designer doesn't have to.
  127. Remember, designing classes is meant to be easy.
  128.  
  129. >In fact, even simple
  130. >gadgetclass objects are created and configured on the application
  131. >context, event handling and refresh are done on input.device context.
  132.  
  133. Yep -- gadgetclass objects do that alright. You're right on the money
  134. there. MUI objects, however, are not gadgetclass objects.
  135.  
  136. >The methods do not run at pri 20 by default. And if you look at
  137. >datatypes (which are just special versions of gadgetclass) you see
  138. >that these can offload operations to a separate task or to the
  139. >application (by sending a sync message).
  140.  
  141. Yes. And look at what happens when the programmer isn't being *very*
  142. careful -- AmigaGuide.datatype and Grapevine's scrolling text display. 
  143. If you leave it up to the programmer and they make a mistake (which is
  144. easy enough), you can wind up with jerky mouse pointers using that
  145. system. At least with MUI the worst that can happen is a sluggish
  146. application. The rest of the system is fine.
  147.  
  148. >Because you cannot ensure that the event handling loop is always
  149. >ready and waiting. Another task at default priority can slow down
  150. >your loop. There is no way to change that but to control priorities
  151. >of all tasks.
  152.  
  153. Well, there is another way -- each MUI program could run its event loop
  154. at pri 1. :-) However that's not necessary. As I said, the worst that
  155. happens is the app becomes unresponsive, and that can be fixed simply
  156. by the user or the programs responsible or something like Executive
  157. running CPU intensive tasks at a lower priority. I do that *anyway*,
  158. regardless of MUI, because I don't like my interactive programs to
  159. become needlessly sluggish. It's not a big enough problem to want to
  160. give up the simplicity and generality of OO programming under MUI's
  161. current implementation to remedy.
  162.  
  163. >On the other hand it is simple to rely on input.device to run at pri
  164. >20 ahead of all other tasks.
  165.  
  166. Sure -- and get frozen mouse pointers when you screw up, have locking
  167. problems associated with two different threads of execution running
  168. through your custom classes, or having special cases for a few simple
  169. gadgets that can be cheaply refreshed by Intuition, etc.
  170.  
  171. >>That's right -- the *programmer* is left the task of offloading
  172. >>expensive operations,
  173.  
  174. >No. If you use MUI _then_ the programmer is left the task of offloading
  175. >expensive operations. With datatypes this is done by the datatype
  176. >itself.
  177.  
  178. At least with MUI, when you *do* spawn a task, it's entirely under your
  179. control. It has nothing to do with MUI, it will never be touched by
  180. MUI, it is a simple, normal, subtask. As I said, the subtasking has
  181. nothing to do with your OO system, which keeps the OO system simple.
  182.  
  183. >>A complex AmigaGuide document can stop my mouse pointer
  184. >>moving for a second or more.
  185.  
  186. >As I said this is a flaw in the AmigaGuide datatype.
  187.  
  188. Yep. Even a professional programmer at C= can make a mistake. Imagine
  189. if the programmers of all those MUI programs on Aminet were exposed to
  190. the same difficulties...
  191.  
  192. >Or use a sensible scheme in your GUI toolkit so that this isn't a
  193. >problem.
  194.  
  195. "Sensible" in this case is obviously very much a matter of taste. I'd
  196. rather something that was simple, uniform, and completely general with
  197. no special cases and "gotcha"'s.
  198.  
  199. >>Running
  200. >>CPU intensive processes at pri 0 *will* make the machine feel slower.
  201.  
  202. >That's why you do not want to run the GUI at this priority.
  203.  
  204. *NOT* just the GUI. Making 'ls' eight times slower by running just two
  205. tasks isn't helped by a pri 20 GUI.
  206.  
  207. >>You *will* notice the effect in your text editor.
  208.  
  209. >But you do not have to notice this in your GUI.
  210.  
  211. Nope, the GUI will depress buttons fine. But the delay in characters
  212. appearing that you have typed will more than compensate. That delay
  213. won't exist if the CPU intensive stuff is at a lower priority.
  214.  
  215. >>You *will* notice
  216. >>that, while a button still depresses instantly, the application takes
  217. >>longer to respond.
  218.  
  219. >That's obvious. If the machine is busy then it becomes slower.
  220.  
  221. It needn't. If I run 20 CPU intensive processes at pri 0, the machine
  222. is practically unuseable. Anything doing lots of I/O will lose out in
  223. a large way. However I have run over 400 CPU intensive processes at
  224. pri -10 in the past (before I ran out of memory) and apart from the
  225. lack of memory, you wouldn't even know they were there (except new
  226. process creation was slow).
  227.  
  228. Running interactive stuff at a higher priority doesn't cause the CPU
  229. intensive stuff to miss out on any cycles they would've got anyway.
  230. But running CPU intensive stuff at the same priority has a huge impact
  231. on the interactive stuff, which keeps giving up portions of their
  232. quanta and waiting their turn again.
  233.  
  234. >>Watch your text editor also become sluggish.
  235.  
  236. >This depends on your text editor. A text editor based on BOOPSI code
  237. >wouldn't become sluggish.
  238.  
  239. You're saying that characters be processed and displayed as they are
  240. entered, on input.device's context? Cut and paste? Reformatting as you
  241. type? Online spell checking? The text editor probably won't be
  242. sluggish, but I bet your pointer sure becomes jerky and you'd want to
  243. avoid using your serial port for anything important.
  244.  
  245. >>It isn't responsive if (gasp) I run another CPU intensive task at
  246. >>priority 0,
  247.  
  248. >It is more responsive than a MUI application under the same condition.
  249.  
  250. Yes. You are perfectly correct. Does that mean all apps should
  251. "suffer" because it "hurts" MUI more?
  252.  
  253. >>or if it's coping with many connections and image
  254. >>decompressions while I'm trying to scroll through a large document.
  255.  
  256. >Overloading a machine is never fast and changing priorities won't
  257. >change that.
  258.  
  259. Of course it does. I suggest you try it sometime. Remember, AmigaOS
  260. isn't like Unix.
  261.  
  262. (As an aside -- using more threads, thanks to Exec's scheduler, will
  263. actually make your program relatively *faster* in a heavily loaded
  264. environment. Run 10 CPU intensive tasks, compare two programs A & B
  265. which do the same thing. A uses one thread, B uses 10. B will get
  266. about 1/2 the CPU in total, A will get about 10%. Guess which will go
  267. faster...)
  268.  
  269. >Sure. But with Executive the various CPU intensive tasks do not
  270. >timeslice any longer (a 1 second timeslice is ridiculous).
  271.  
  272. Of course, as Petri has said, this can be reduced by reducing the
  273. number of priority levels in use, and (apparently) the registered
  274. version does more to ensure more tasks run at the same pri -> normal
  275. Exec scheduling for those tasks.
  276.  
  277. >>Many programs (eg. Real3D, IBrowse) spawn subtasks to do CPU intensive
  278. >>tasks. (Note that *only* CPU intensive programs need do this, other
  279. >>"standard programs" make no difference.)
  280.  
  281. >I'm talking about close to any program. Even DIR or LIST have to
  282. >change priorities fore and back because they possibly sort the output.
  283. >Evey standard ANSI C program would have to be modified.
  284.  
  285. Don't be rediculous. It's only a problem if the CPU intensive operation
  286. goes for long enough for the user to switch to another, interactive,
  287. task, and say "Oh, boy, this is unresponsive". Things like 'dir' or
  288. 'list' typically don't fit into that category, and even if they did and
  289. the user didn't want to run Executive, they could simply run their
  290. shells at a lower priority than 0. Alternatively, MUI programs could
  291. run at 1 (I notice GoldEd does this. It's a lot better than 20, if you
  292. ask me).
  293.  
  294. >Now what is easier, especially when you think that Intuition and the
  295. >console is based on the second model and the fact that most programs
  296. >that require interactive responsiveness use Intuition ?
  297.  
  298. Umm... Let me think. I would say the easiest way would be to do it
  299. like AmigaGuide.datatype does it? Am I wrong? Has the
  300. AmigaGuide.datatype actually done it the hard way?
  301.  
  302. From the programmers point of view, an OO system that doesn't
  303. *require* the programmer to worry about multiple contexts calling his
  304. custom class, and provides a consistent and complete mechanism for all
  305. classes, sounds like the simplest way to go. If they *do* decide to
  306. run a separate thread (which they should do if they're going to be
  307. waiting some time before processing user input and not put the
  308. application to sleep), then it doesn't make any difference to use a
  309. "-1" for its priority instead of "0". The thread doesn't know anything
  310. about MUI, MUI doesn't know anything about the thread. Sounds -- and
  311. is -- pretty simple.  
  312.  
  313. >But you do care wether AWeb presents you a page while loading or
  314. >wether Executive prevents this.
  315.  
  316. The page was presented while loading. AWeb simply didn't respond to
  317. input. A special entry in Executive fixed this. IBrowse also presents
  318. a page while loading and responds to input, with or without Executive.
  319. It didn't need a special entry.
  320.  
  321. >But it makes a difference when the process is important and not
  322. >only the completition of the process.
  323.  
  324. But it won't be starved of CPU by the event loop, now, will it?
  325. Remember, I was suggesting run *all* CPU intensive subtasks at the
  326. same, lower priority. The event loop doesn't take much, and you want
  327. that to get the CPU immediately whenever you click something, anyway.
  328. I can envisage an example (although IBrowse and AWeb don't apply)
  329. where you have multiple processes (eg. playing separate animations)
  330. that need to be timesliced quickly to appear they are all running at
  331. once. If you were running Executive you would probably want to use one
  332. of the better schedulers or make a special entry in this case.
  333.  
  334. >But which is a wild guess. In case of AWeb or other programs that
  335. >are interactive _and_ need CPU time you lose.
  336.  
  337. Not if they spawn lower priority subtasks for the CPU intensive stuff.
  338. AWeb already spawns subtasks, they're just at the wrong priority.
  339.  
  340. >>Are you
  341. >>happy waiting 4 seconds for an 'ls' that *could* have been finished in
  342. >>0.5? Just because *two* other tasks are running?
  343.  
  344. >Are you complaining about AWeb not displaying a page while loading ?
  345.  
  346. Did you read my post? AWeb displayed a page while loading fine. It just
  347. didn't respond to user input. The page layout thread (whatever that
  348. was) was getting plenty of CPU -- as the page was quickly being
  349. displayed -- but the clicks on the gadgets went unheeded until the page
  350. was finished 2 1/2 minutes later (although, I'm sure you'll be pleased
  351. to know, they *were* refreshed alright).
  352.  
  353. No, my example had nothing to do with AWeb. The point, as I hoped was
  354. obvious, but that you've totally failed to respond to, was how
  355. desireable offloading CPU intensive code to a low priority task is. You
  356. claim MUI is the reason for wanting this and you don't need it
  357. otherwise. The 'ls' example shows a real-life, non-MUI example of just
  358. what happens under AmigaOS when you try to run CPU intensive tasks at
  359. the same priority as I/O bound tasks. No other tasks, 0.5 seconds for
  360. the 'ls'.  Two other tasks, 4.0 seconds for the 'ls'. Eight times
  361. slower. No MUI. Ten other tasks, priority just below the 'ls' task,
  362. 0.5 seconds. This applies to any task doing I/O -- they keep giving up
  363. their quantums before they're finished, losing out on their fair share
  364. of the CPU pie. They can't save it until later. Exec's scheduler is
  365. deadly for I/O bound tasks under a heavy load.
  366.  
  367. >If it lasts 157 seconds then there is a need for another task (or at
  368. >least a heavy busy sign). 
  369.  
  370. Ah, I'm glad you agree, then. A busy sign isn't desired, because AWeb
  371. is meant to be able to allow you to click on a link on the page as
  372. it's displayed (which it does now that I've told Executive to put AWeb
  373. and all it's childtasks at a fixed priority). For some reason, the
  374. data was being transferred, images decoded, page layed out and
  375. displayed, all perfectly -- with the one small problem that no user
  376. input was processed while Executive was fiddling with priorities. Weird.
  377.  
  378. >But then I haven't seen anything like that
  379. >and I wonder how a 600k page (which is silly btw) can take so much
  380. >longer than the 50k pages that I have seen.
  381.  
  382. If the page layout algorithm has worse than linear complexity it could
  383. easily happen. However, I've just done some tests, and it certainly
  384. appears linear: 48k, 12s; 96k, 24s; 192k, 50s; 384k, 103s. This is 
  385. consistent with 157s for a 600k page. Are you getting much less than
  386. 12s for 50k pages (this is across ethernet, BTW)?
  387.  
  388. >You can only stop network activity.
  389.  
  390. That's a shame. I'd prefer it to progressively display pages as it got
  391. them from the cache, like it does when transferring them across the
  392. network. Then I could click on them or go somewhere else without
  393. having to wait for it to finish. Currently it just locks up until the
  394. page is ready to be displayed.
  395.  
  396. >IBrowse becomes sluggish without Executive too.
  397.  
  398. Yes, if you're running other CPU intensive tasks at the same priority.
  399. (If not, it doesn't, because it's own CPU intensive tasks run at a
  400. lower priority.) So does an 'ls'. Even more reason for asking
  401. programmers to offload CPU intensive stuff to a lower priority,
  402. don't you think? I'm not saying MUI *isn't* affected, I'm saying lots
  403. of things *are*. Not just MUI, and in the case of 'ls', some worse
  404. than MUI.
  405.  
  406. >I do not blame it on Executive and MUI. I say that MUI requires
  407. >Executive or changes in almost every program. And I do not want to
  408. >change almost every program just to keep MUI happy. I'd rather use
  409. >something like MUI that does not require me to change these programs.
  410.  
  411. MUI requires the same thing the 'ls' and the text editor does --
  412. programmers to use lower priorities for CPU intensive stuff, if the CPU
  413. intensive stuff is going to take long enough for the user to want to do
  414. something interactive in the meantime. The vast majority of programs do
  415. not fit into this category. A few do. Decoding images in a web browser
  416. can take a while, and the user is likely to want to scroll the document
  417. while they're waiting, so it makes sense to offload that to a lower
  418. priority. IBrowse does. AWeb would benefit from it too, regardless of
  419. whether MUI is used or not. It *would* make it respond quicker to user
  420. actions (where "respond" doesn't just mean "make the button depressed",
  421. but also means *do what the user wants* -- like follow a link).
  422.  
  423. It really doesn't seem like a lot to ask, especially since he *is*
  424. already spawning off several threads to deal with different tasks.
  425.  
  426. >And running interactive tasks at a high priority does the same and
  427. >was done by Intuition - to some degree - all the time. 
  428.  
  429. It does *not* make the apps more responsive. *All* it does is make a
  430. few gadgets visually respond quickly. The apps themselves will take
  431. longer to process your input -- whether it be typing, or clicking on a
  432. WWW link, or telling it to stop loading a page -- and all of it
  433. unnecessary!
  434.  
  435. >I'm not happy
  436. >if I had to change this and many other programs where you require
  437. >them to spawn off CPU intensive work to other tasks. 
  438.  
  439. Fine. I'll just run them at a lower priority, like I'm doing now with
  440. AWeb. The other apps in the system will still be responsive, only those
  441. ones will feel sluggish. I'd just prefer that they didn't feel
  442. sluggish, either.
  443.  
  444. >Going the other way round is much easier and doesn't require changes.
  445.  
  446. Going the other way round doesn't do programs like 'ls' much good.
  447. MUI programs are just one class of program to benefit, and by no means
  448. the only ones.
  449.  
  450. >                                Michael van Elst
  451. >Internet: mlelstv@serpens.rhein.de
  452.  
  453. -- 
  454. Jason S Birch                        ,-_|\ email: jasonb@cs.uwa.edu.au
  455. Department of Computer Science      /     \ Tel (work): +61 9 380 1840
  456. The University of Western Australia *_.-._/ Fax (work): +61 9 380 1089
  457. Nedlands  W. Australia  6907             v  Tel (home): +61 9 386 8630
  458.